﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using UnityEngine.EventSystems;

public class PullingItemScript : MonoBehaviour, IPointerClickHandler
{
    private Text _text;

    public Action<Text> EnableOnClick;

    void Awake()
    {
        //Init();
    }

    public void Init(string text, Action<Text> enableOnClick)
    {
        _text = transform.GetChild(0).GetComponent<Text>();
        _text.text = text;
        EnableOnClick = enableOnClick;
    }


    public void OnPointerClick(PointerEventData eventData)
    {
        if (EnableOnClick != null) EnableOnClick(_text);
    }
}
